<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    <title>Zend_Service_StrikeIron: Advanced Uses - Zend Framework Manual</title>

    <link href="../css/shCore.css" rel="stylesheet" type="text/css" />
    <link href="../css/shThemeDefault.css" rel="stylesheet" type="text/css" />
    <link href="../css/styles.css" media="all" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>Zend Framework</h1>
<h2>Programmer's Reference Guide</h2>
<ul>
    <li><a href="../en/zend.service.strikeiron.advanced-uses.html">Inglês (English)</a></li>
    <li><a href="../pt-br/zend.service.strikeiron.advanced-uses.html">Português Brasileiro (Brazilian Portuguese)</a></li>
</ul>
<table width="100%">
    <tr valign="top">
        <td width="85%">
            <table width="100%">
                <tr>
                    <td width="25%" style="text-align: left;">
                    <a href="zend.service.strikeiron.bundled-services.html">Zend_Service_StrikeIron: Bundled Services</a>
                    </td>

                    <td width="50%" style="text-align: center;">
                        <div class="up"><span class="up"><a href="zend.service.html">Zend_Service</a></span><br />
                        <span class="home"><a href="manual.html">Guia de Refer&ecirc;ncia do Programador</a></span></div>
                    </td>

                    <td width="25%" style="text-align: right;">
                        <div class="next" style="text-align: right; float: right;"><a href="zend.service.technorati.html">Zend_Service_Technorati</a></div>
                    </td>
                </tr>
            </table>
<hr />
<div id="zend.service.strikeiron.advanced-uses" class="section"><div class="info"><h1 class="title">Zend_Service_StrikeIron: Advanced Uses</h1></div>
    

    <p class="para">
        This section describes the more advanced uses of
        <span class="classname">Zend_Service_StrikeIron</span>.
    </p>

    <div class="section" id="zend.service.strikeiron.advanced-uses.services-by-wsdl"><div class="info"><h1 class="title">Using Services by WSDL</h1></div>
        

        <p class="para">
            Some StrikeIron services may have a <acronym class="acronym">PHP</acronym> wrapper class available,
            such as those described in
            <a href="zend.service.strikeiron.bundled-services.html" class="link">Bundled Services</a>.
            However, StrikeIron offers hundreds of services and many of these
            may be usable even without creating a special wrapper class.
        </p>

        <p class="para">
            To try a StrikeIron service that does not have a wrapper class available,
            give the <span class="property">wsdl</span> option to  <span class="methodname">getService()</span>
            instead of the <span class="property">class</span> option:
        </p>

        <pre class="programlisting brush: php">
$strikeIron = new Zend_Service_StrikeIron(array(&#039;username&#039; =&gt; &#039;your-username&#039;,
                                                &#039;password&#039; =&gt; &#039;your-password&#039;));

// Get a generic client to the Reverse Phone Lookup service
$phone = $strikeIron-&gt;getService(
    array(&#039;wsdl&#039; =&gt; &#039;http://ws.strikeiron.com/ReversePhoneLookup?WSDL&#039;)
);

$result = $phone-&gt;lookup(array(&#039;Number&#039; =&gt; &#039;(408) 253-8800&#039;));
echo $result-&gt;listingName;

// Zend Technologies USA Inc
</pre>


        <p class="para">
            Using StrikeIron services from the WSDL will require at least some understanding
            of the WSDL files. StrikeIron has many resources on its site to help with this. Also,
            <a href="http://janschneider.de" class="link external">&raquo; Jan Schneider</a> from the <a href="http://horde.org" class="link external">&raquo; Horde project</a> has written a <a href="http://janschneider.de/news/25/268" class="link external">&raquo; small <acronym class="acronym">PHP</acronym>
                routine</a> that will format a WSDL file into more readable
            <acronym class="acronym">HTML</acronym>.
        </p>

        <p class="para">
            Please note that only the services described in the <a href="zend.service.strikeiron.bundled-services.html" class="link">Bundled Services</a>
            section are officially supported.
        </p>
    </div>

    <div class="section" id="zend.service.strikeiron.viewing-soap-transactions"><div class="info"><h1 class="title">Viewing SOAP Transactions</h1></div>
        

        <p class="para">
            All communication with StrikeIron is done using the <acronym class="acronym">SOAP</acronym> extension.
            It is sometimes useful to view the <acronym class="acronym">XML</acronym> exchanged with StrikeIron for
            debug purposes.
        </p>

        <p class="para">
            Every StrikeIron client (subclass of
            <span class="classname">Zend_Service_StrikeIron_Base</span>) contains a
             <span class="methodname">getSoapClient()</span> method to return the underlying instance of
            <span class="classname">SOAPClient</span> used to communicate with StrikeIron.
        </p>

        <p class="para">
            <acronym class="acronym">PHP</acronym>&#039; <a href="http://www.php.net/manual/en/function.soap-soapclient-construct.php" class="link external">&raquo; SOAPClient</a>
            has a <span class="property">trace</span> option that causes it to remember the
            <acronym class="acronym">XML</acronym> exchanged during the last transaction.
            <span class="classname">Zend_Service_StrikeIron</span> does not enable the
            <span class="property">trace</span> option by default but this can easily by changed
            by specifying the options that will be passed to the <span class="classname">SOAPClient</span>
            constructor.
        </p>

        <p class="para">
            To view a SOAP transaction, call the  <span class="methodname">getSoapClient()</span> method
            to get the <span class="classname">SOAPClient</span> instance and then call the appropriate
            methods like <a href="http://www.php.net/manual/en/function.soap-soapclient-getlastrequest.php" class="link external">&raquo;  <span class="methodname">__getLastRequest()</span></a>
            and <a href="http://www.php.net/manual/en/function.soap-soapclient-getlastresponse.php" class="link external">&raquo;  <span class="methodname">__getLastRequest()</span></a>:
        </p>

        <pre class="programlisting brush: php">
$strikeIron =
    new Zend_Service_StrikeIron(array(&#039;username&#039; =&gt; &#039;your-username&#039;,
                                      &#039;password&#039; =&gt; &#039;your-password&#039;,
                                      &#039;options&#039;  =&gt; array(&#039;trace&#039; =&gt; true)));

// Get a client for the Sales &amp; Use Tax Basic service
$taxBasic = $strikeIron-&gt;getService(array(&#039;class&#039; =&gt; &#039;SalesUseTaxBasic&#039;));

// Perform a method call
$taxBasic-&gt;getTaxRateCanada(array(&#039;province&#039; =&gt; &#039;ontario&#039;));

// Get SOAPClient instance and view XML
$soapClient = $taxBasic-&gt;getSoapClient();
echo $soapClient-&gt;__getLastRequest();
echo $soapClient-&gt;__getLastResponse();
</pre>

    </div>
</div>
        <hr />

            <table width="100%">
                <tr>
                    <td width="25%" style="text-align: left;">
                    <a href="zend.service.strikeiron.bundled-services.html">Zend_Service_StrikeIron: Bundled Services</a>
                    </td>

                    <td width="50%" style="text-align: center;">
                        <div class="up"><span class="up"><a href="zend.service.html">Zend_Service</a></span><br />
                        <span class="home"><a href="manual.html">Guia de Refer&ecirc;ncia do Programador</a></span></div>
                    </td>

                    <td width="25%" style="text-align: right;">
                        <div class="next" style="text-align: right; float: right;"><a href="zend.service.technorati.html">Zend_Service_Technorati</a></div>
                    </td>
                </tr>
            </table>
</td>
        <td style="font-size: smaller;" width="15%"> <style type="text/css">
#leftbar {
	float: left;
	width: 186px;
	padding: 5px;
	font-size: smaller;
}
ul.toc {
	margin: 0px 5px 5px 5px;
	padding: 0px;
}
ul.toc li {
	font-size: 85%;
	margin: 1px 0 1px 1px;
	padding: 1px 0 1px 11px;
	list-style-type: none;
	background-repeat: no-repeat;
	background-position: center left;
}
ul.toc li.header {
	font-size: 115%;
	padding: 5px 0px 5px 11px;
	border-bottom: 1px solid #cccccc;
	margin-bottom: 5px;
}
ul.toc li.active {
	font-weight: bold;
}
ul.toc li a {
	text-decoration: none;
}
ul.toc li a:hover {
	text-decoration: underline;
}
</style>
 <ul class="toc">
  <li class="header home"><a href="manual.html">Guia de Refer&ecirc;ncia do Programador</a></li>
  <li class="header up"><a href="manual.html">Guia de Refer&ecirc;ncia do Programador</a></li>
  <li class="header up"><a href="reference.html">Refer&ecirc;ncia do Zend Framework</a></li>
  <li class="header up"><a href="zend.service.html">Zend_Service</a></li>
  <li><a href="zend.service.introduction.html">Introdu&ccedil;&atilde;o</a></li>
  <li><a href="zend.service.akismet.html">Zend_Service_Akismet</a></li>
  <li><a href="zend.service.amazon.html">Zend_Service_Amazon</a></li>
  <li><a href="zend.service.amazon.ec2.html">Zend_Service_Amazon_Ec2</a></li>
  <li><a href="zend.service.amazon.ec2.instance.html">Zend_Service_Amazon_Ec2: Instances</a></li>
  <li><a href="zend.service.amazon.ec2.windows.instance.html">Zend_Service_Amazon_Ec2: Windows Instances</a></li>
  <li><a href="zend.service.amazon.ec2.reserved.instance.html">Zend_Service_Amazon_Ec2: Reserved Instances</a></li>
  <li><a href="zend.service.amazon.ec2.cloudwatch.html">Zend_Service_Amazon_Ec2: CloudWatch Monitoring</a></li>
  <li><a href="zend.service.amazon.ec2.images.html">Zend_Service_Amazon_Ec2: Amazon Machine Images (AMI)</a></li>
  <li><a href="zend.service.amazon.ec2.ebs.html">Zend_Service_Amazon_Ec2: Elastic Block Storage (EBS)</a></li>
  <li><a href="zend.service.amazon.ec2.elasticip.html">Zend_Service_Amazon_Ec2: Elastic IP Addresses</a></li>
  <li><a href="zend.service.amazon.ec2.keypairs.html">Zend_Service_Amazon_Ec2: Keypairs</a></li>
  <li><a href="zend.service.amazon.ec2.zones.html">Zend_Service_Amazon_Ec2: Regions and Availability Zones</a></li>
  <li><a href="zend.service.amazon.ec2.securitygroups.html">Zend_Service_Amazon_Ec2: Security Groups</a></li>
  <li><a href="zend.service.amazon.s3.html">Zend_Service_Amazon_S3</a></li>
  <li><a href="zend.service.amazon.sqs.html">Zend_Service_Amazon_Sqs</a></li>
  <li><a href="zend.service.audioscrobbler.html">Zend_Service_Audioscrobbler</a></li>
  <li><a href="zend.service.delicious.html">Zend_Service_Delicious</a></li>
  <li><a href="zend.service.developergarden.html">Zend_Service_DeveloperGarden</a></li>
  <li><a href="zend.service.ebay.html">Zend_Service_Ebay</a></li>
  <li><a href="zend.service.ebay.finding.html">Zend_Service_Ebay_Finding</a></li>
  <li><a href="zend.service.flickr.html">Zend_Service_Flickr</a></li>
  <li><a href="zend.service.livedocx.html">Zend_Service_LiveDocx</a></li>
  <li><a href="zend.service.nirvanix.html">Zend_Service_Nirvanix</a></li>
  <li><a href="zend.service.recaptcha.html">Zend_Service_ReCaptcha</a></li>
  <li><a href="zend.service.short-url.html">Zend_Service_ShortUrl</a></li>
  <li><a href="zend.service.simpy.html">Zend_Service_Simpy</a></li>
  <li><a href="zend.service.slideshare.html">Zend_Service_SlideShare</a></li>
  <li><a href="zend.service.strikeiron.html">Zend_Service_StrikeIron</a></li>
  <li><a href="zend.service.strikeiron.bundled-services.html">Zend_Service_StrikeIron: Bundled Services</a></li>
  <li class="active"><a href="zend.service.strikeiron.advanced-uses.html">Zend_Service_StrikeIron: Advanced Uses</a></li>
  <li><a href="zend.service.technorati.html">Zend_Service_Technorati</a></li>
  <li><a href="zend.service.twitter.html">Zend_Service_Twitter</a></li>
  <li><a href="zend.service.windowsazure.html">Zend_Service_WindowsAzure</a></li>
  <li><a href="zend.service.windowsazure.storage.blob.html">Zend_Service_WindowsAzure_Storage_Blob</a></li>
  <li><a href="zend.service.windowsazure.diagnostics.manager.html">Zend_Service_WindowsAzure_Diagnostics_Manager</a></li>
  <li><a href="zend.service.windowsazure.storage.queue.html">Zend_Service_WindowsAzure_Storage_Queue</a></li>
  <li><a href="zend.service.windowsazure.storage.table.html">Zend_Service_WindowsAzure_Storage_Table</a></li>
  <li><a href="zend.service.yahoo.html">Zend_Service_Yahoo</a></li>
 </ul>
 </td>
    </tr>
</table>

<script type="text/javascript" src="../js/shCore.js"></script>
<script type="text/javascript" src="../js/shAutoloader.js"></script>
<script type="text/javascript" src="../js/main.js"></script>

</body>
</html>